﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.Infrastructure;
using DLM.Domain.Model;

namespace DLM.Data.EF.CodeFirst.Mapping
{
    public class SalutationMap : EntityTypeConfiguration<Salutation>
    {
        public SalutationMap()
        {
            this.HasKey(t => t.SID);
            this.ToTable("Salutation");
            this.Property(t => t.SID).HasColumnName("SID");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.GreetID).HasColumnName("GreetID");
            this.Property(t => t.IsConfirm).HasColumnName("IsConfirm");
            this.Property(t => t.SentDate).HasColumnName("SentDate");
            this.Property(t => t.Message).HasColumnName("Message").HasMaxLength(20);
            this.HasRequired(t => t.User).WithMany(t =>t.Salutation).HasForeignKey(d => d.UserID);
        }
    }
}
